package tt.dz.order.vo;

import java.text.ParseException;
import java.util.Date;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import tt.dz.order.util.ThreadSafeDateFormat;

/**
 * 
 * @name 订单修改历史查询请求队列
 * @author Anson
 * @version 1.0
 * @summary
 * @desc
 *
 */
public class QueryOrderChangeLogResportVO {
	// 消费开始日期字符串
	private String startStr;
	// 消费开始日期
	private Date startDate;
	// 消费结束日期字符串
	private String endStr;
	// 消费结束日期
	private Date endDate;
	//查询类型
	private String queryType;
	// 查询值
	private String queryValue;

	public QueryOrderChangeLogResportVO() {
		super();
	}
	
	/**
	 * 卡类型 08 虚拟，06 实体卡 ，07 身份识别卡
	 * 
	 */
	public static enum QueryType {
		userid("1", "用户id"), orderNo("2", "订单号"), userMobileNo("3", "操作员电话号码"), createTime("4", "修改时间"), orderCreateTime("5", "订单修改时间");

		private String value;
		private String desc;

		private QueryType(String value, String desc) {
			this.value = value;
			this.desc = desc;
		}

		public String value() {
			return this.value;
		}

		public String toString() {
			return this.value + ":" + this.desc;
		}

		public String getDesc() {
			return desc;
		}

		/**
		 * 获取枚举对象
		 * 
		 * @author Anson
		 * @createDate 2016年4月27日
		 * @desc 根据传入的value
		 * @param value
		 * @return CardType
		 */
		public static final QueryType indexOf(String value) {
			for (QueryType v : QueryType.values()) {
				if (v.value().equals(value)) {
					return v;
				}
			}
			return null;
		}
	}

	public String getStartStr() {
		return startStr;
	}

	public void setStartStr(String startStr) {
		this.startStr = startStr;
		if (StringUtils.isNotBlank(startStr)) {
			try {
				startDate = ThreadSafeDateFormat.parse(startStr, ThreadSafeDateFormat.DATE_FMT);
			} catch (ParseException e) {
			}
		}
	}

	public String getEndStr() {
		return endStr;
	}

	public void setEndStr(String endStr) {
		this.endStr = endStr;
		if (StringUtils.isNotBlank(endStr)) {
			try {
				endDate = ThreadSafeDateFormat.parse(endStr, ThreadSafeDateFormat.DATE_FMT);
			} catch (ParseException e) {
			}
		}
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getQueryType() {
		return queryType;
	}

	public void setQueryType(String queryType) {
		this.queryType = queryType;
	}

	public String getQueryValue() {
		return queryValue;
	}

	public void setQueryValue(String queryValue) {
		this.queryValue = queryValue;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}

	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(this, obj);
	}
}
